Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@babel/helper-replace-supers
Advanced tools
@babel/helper-replace-supers is a Babel helper module that assists in handling super method calls and super property accesses in JavaScript classes. It is particularly useful when transforming ES6+ code to ES5, ensuring that the semantics of super calls are preserved correctly.
Super Method Call Replacement
This feature allows you to replace super method calls within a class method. The `replaceSuper` function is used to handle the transformation, ensuring that the correct object and super references are maintained.
const { replaceSuper } = require('@babel/helper-replace-supers');
function replaceSuperMethodCall(path, state) {
replaceSuper(path, state, {
getObjectRef() {
return path.node.object;
},
getSuperRef() {
return path.node.super;
},
file: state.file
});
}
Super Property Access Replacement
This feature allows you to replace super property accesses within a class. Similar to method call replacement, the `replaceSuper` function ensures that property accesses are correctly transformed.
const { replaceSuper } = require('@babel/helper-replace-supers');
function replaceSuperPropertyAccess(path, state) {
replaceSuper(path, state, {
getObjectRef() {
return path.node.object;
},
getSuperRef() {
return path.node.super;
},
file: state.file
});
}
This plugin is part of the Babel preset for transforming ES2015 (ES6) classes to ES5. It handles super method calls and property accesses, ensuring compatibility with older JavaScript environments.
Helper function to replace supers
See our website @babel/helper-replace-supers for more information.
Using npm:
npm install --save @babel/helper-replace-supers
or using yarn:
yarn add @babel/helper-replace-supers
FAQs
Helper function to replace supers
The npm package @babel/helper-replace-supers receives a total of 19,778,285 weekly downloads. As such, @babel/helper-replace-supers popularity was classified as popular.
We found that @babel/helper-replace-supers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.